<html>
  <head>
  <title>CRESecure Callback</title>
  <style>
    .frameStyle {
      display: none;
      position: absolute;
      height: 1px;
      width: 1px;
      top: 1px;
      left: 1px;
    }
  </style>
  <script>
    /*
    CRE Secure Callback.html
    Version 1.5.2  
    */
    function querySt(ji) {
      hu = window.location.search.substring(1);
      gy = hu.split("&");
      for (i = 0; i < gy.length; i++) {
        ft = gy[i].split("=");
        if (ft[0] == ji) { 
          return decodeURIComponent(ft[1]);
        }
      }

      return null;
    }   

    errorCode = querySt('errorCode');
    cancel = querySt('cancel');
    whatCVV2 = querySt('whatCVV2');
    whatsThis = querySt('whatsThis');
    gatewayCode = querySt( 'gatewayCode' );
    gatewayMessage = querySt( 'gatewayMessage' );
    currentLocation = querySt('rurl');
    action = querySt('action');
    processStart = querySt('processStart');

    theParent = null;
    complete = false;
   
    function loadFrame() {
      if( (cancel != null || cancel != 'undefined') && (cancel == '1' || cancel == '2') ) {
        try {    
          window.top.cancelCREPayment(cancel);
        } catch( e ) {
          //alert( "Error in cancelCREPayment or syntax error in parent JavaScript. \n" + e.message );
          //return false;
        }
        if (currentLocation != null) document.getElementById( 'loadingCompleteFrame' ).src = currentLocation + "?creReserved=r"; 
      } else if(whatCVV2 != null || whatsThis != null) {
        if(typeof window.top.whatsThis == 'function') {
          try {
            window.top.whatsThis( whatsThis );
          } catch( e ) {
            //alert( "Error in whatsThis or syntax error in parent JavaScript. \n" + e.message );
            //return false;
          }
        } else {
          try {
            window.top.whatCVV2();
          } catch( e ) {
            //alert( "Error in whatCVV2 or syntax error in parent JavaScript. \n" + e.message );
            //return false;
          }
        }
        if (currentLocation != null) document.getElementById( 'loadingCompleteFrame' ).src = currentLocation + "?creReserved=r"; 
      } else if(processStart == '1') {
        try {    
          window.top.startCREPayment();
        } catch( e ) {
        //  alert( "Error in startCREPayment or syntax error in parent JavaScript. \n" + e.message );
        //  return false;
        }
      } else if( ( errorCode == null ) || ( errorCode == 'undefined' ) ) {
        // build a object of all the URL parameters
        responseObject = new Object();
            
        var qStr = window.location.search.substring(1);
        var qStrParts = qStr.split("&");
        for (i = 0; i < qStrParts.length; i++) {
          var qStrNV = qStrParts[i].split("=");
          responseObject[qStrNV[0]] = qStrNV[1];
        }
           
        try {
          window.top.completeCREPayment( responseObject );
        } catch( e ) {
          //alert( "Error in completeCREPayment or syntax error in parent JavaScript. \n" + e.message );
          //return false;
        }
        if (currentLocation != null) document.getElementById( 'loadingCompleteFrame' ).src = currentLocation + "?creReserved=r"; 
      } else {
        if(typeof window.top.creHandleDetailErrors == 'function') {
          try {
            window.top.creHandleDetailErrors( errorCode, gatewayCode, gatewayMessage );
          } catch( e ) {
            //alert( "Error in creHandleDetailErrors or syntax error in parent JavaScript. \n" + e.message );
            //return false;
          }
        } else {
          try {
            window.top.creHandleErrors( errorCode );
          } catch( e ) {
            //alert( "Error in creHandleErrors or syntax error in parent JavaScript. \n" + e.message );
            //return false;
          }
        }
        if (currentLocation != null) document.getElementById( 'loadingCompleteFrame' ).src = currentLocation + "?creReserved=r"; 
      }
   }
  </script>
 </head>
 <body onLoad="loadFrame(); ">
  <iframe id="loadingCompleteFrame" class="frameStyle"></iframe>
  <p>Version 1.5.2</p>
 </body>
</html>